package cn.hj.mapper;

import cn.hj.beans.Person;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author HP
 */

public interface PersonMapper {


     @Select("SELECT * FROM t_person WHERE p_pid = #{id}")
     @Results(id = "person" ,value = {@Result(column = "p_name",property = "name"),@Result(column = "p_age",property = "age")})
    Person getPersonById(int id);

     @ResultMap("person")
    @Select("select * from t_person")
    List<Person> getAllPerson();

    @Insert("insert into t_person set p_name=#{name},p_age=#{age}")
    boolean insertPerson(Person person);
}
